<template>
  <div class="TreeSelect">
    <div class="coent" style="font-size: 18px">
      <!-- <van-tree-select @click-item="handleData" height="94vh" :items="items" :active-id.sync="activeIds" :main-active-index.sync="activeIndex" /> -->
    </div>
    <!-- <div style="margin-top:2px" @click="handleGoToNext">
      <van-button type="info" block>下一步</van-button>
    </div>-->
  </div>
</template>
<script>
import { QuerySignCallback, dataServerOpenDataView, updateDataView, sendBusinessMessage, FileServerProxy } from '../../utils/api'
export default {
  data() {
    return {
      items: [],
      activeIds: [],
      activeIndex: 0,
      tableData: [],
      indexData: [],
      tableData1: [],
      code1: '',
      isType: '',
      isxtxgj: '',
      ispqgs: '',
      rowData: [],
      isnhzg: '',
      sdcwfGuid: '',
      TASK_ID: ''
    }
  },
  mounted() {
    if (ZWJSBridge) {
      ZWJSBridge.setTitle({
        title: '选择人员'
      })
        .then((res) => {})
        .catch((err) => {})
    }
  },
  methods: {
    getData: async function (data) {
      if (this.$route.query?.SJXK == 1 || this.$route.query?.SJXK == 2 || this.$route.query?.SJXK == 5) {
        //施工备案
        let DQHDAta = JSON.parse(window.sessionStorage.getItem('fileData'))
        var I_ZJCITY = ''
        if (DQHDAta.BUILDTYPE == 14 || this.$store.state.VERSIONNUMBER == 1) {
          I_ZJCITY = DQHDAta.VILLAGE
        } else {
          I_ZJCITY = DQHDAta.CUN
        }
        // this.$route.query.data.TASK_ID = resCreateData.TaskId;
        // 创建流程接口
        let NHApplyParam = {
          accessCode: '2c824ce489ff4cffaa0d77082e6fb648',
          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: {
            wfGuid:
              this.$store.state.VERSIONNUMBER == 1
                ? '{128070D0-52B2-4E92-ADD8-96D6F9044C60}'
                : this.$route.query?.SJXK == 1
                ? '{5F605C24-CFE0-49A1-B4EC-2BA85C5FF672}'
                : this.$route.query?.SJXK == 2
                ? '{D8CE8FDE-C99C-4951-870E-CD03FA9E6FB5}'
                : '{7A440F29-3FD5-498A-AE43-F6C4E1350B34}',
            entityRowGuid: DQHDAta.ROW_GUID
          }
        }
        const NHApplyresData = await FileServerProxy(NHApplyParam)

        let SendFNHApplyresData = JSON.parse(NHApplyresData.data.data)
        if (SendFNHApplyresData.ErrorMsg == '没有发起流程的权限！') {
          this.$toast.fail(SendFNHApplyresData.ErrorMsg)
          return false
        }
        let params = {
          accessCode: '3ec88931e2bf429d9ceadff8697b6772',
          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: {
            bizGuid: '4958f6d9-32d1-437c-a5f1-6e296a891eaa',
            wfGuid:
              this.$store.state.VERSIONNUMBER == 1
                ? '{128070D0-52B2-4E92-ADD8-96D6F9044C60}'
                : this.$route.query?.SJXK == 1
                ? '{5F605C24-CFE0-49A1-B4EC-2BA85C5FF672}'
                : this.$route.query?.SJXK == 2
                ? '{D8CE8FDE-C99C-4951-870E-CD03FA9E6FB5}'
                : '{7A440F29-3FD5-498A-AE43-F6C4E1350B34}',
            entityRowGuid: DQHDAta.ROW_GUID,
            token: window.localStorage.getItem('token')
          }
        }
        const resCreate = await FileServerProxy(params)
        let resCreateData = JSON.parse(resCreate.data.data)
        this.TASK_ID = resCreateData.TaskId
        let paramstaskid = {
          taskId: resCreateData.TaskId,
          wfGuid:
            this.$store.state.VERSIONNUMBER == 1
              ? '{128070D0-52B2-4E92-ADD8-96D6F9044C60}'
              : this.$route.query?.SJXK == 1
              ? '{5F605C24-CFE0-49A1-B4EC-2BA85C5FF672}'
              : this.$route.query?.SJXK == 2
              ? '{D8CE8FDE-C99C-4951-870E-CD03FA9E6FB5}'
              : '{7A440F29-3FD5-498A-AE43-F6C4E1350B34}',
          direction: 0
        }
        let paramsV2 = {
          accessCode: '0a709d649c314903a72225edb8bc8c2a',
          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: paramstaskid
        }
        //获取人员接口
        const resSend = await QuerySignCallback(paramsV2)
        var SendFormData = JSON.parse(resSend.data.data)
        //定义发送人员1
        let zjjbrex = {
          procName: 'up_townaudit',
          dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 9 }])
        }
        let zgjbrfu = {
          accessCode: '69db6bece3a7480592e2ec753d1e335e',
          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: zjjbrex
        }
        const reszgjbe = await FileServerProxy(zgjbrfu)
        let reszgjbe1 = JSON.parse(reszgjbe.data.data)

        console.log(reszgjbe1, 'reszgjbe1')
        // SendFormData.SendData.forEach(nodeItem => {

        // })
        var maxtnid = 0 //获取tnid最大值
        var tnid = 1
        reszgjbe1.Data.forEach((zgjbr) => {
          var newItem = {}
          maxtnid = maxtnid + 1
          newItem.TNID = maxtnid
          newItem.PTNID = tnid
          newItem.TEXT = zgjbr.ST_NAME
          newItem.USERNAME = zgjbr.ST_NAME
          newItem.SINGLEASSIGN = true
          newItem.PREJUNCNODEGUID = ''
          newItem.SORTNUM = 0
          newItem.USERID = zgjbr.ST_ID
          newItem.AUTOCHECKED = true
          newItem.ISUSER = 1
          ;(newItem.wfNodeGuid =
            this.$route.query?.SJXK == 1
              ? '{1A096173-250B-41E4-AAF3-4C450D2C9359}'
              : this.$route.query?.SJXK == 2
              ? '{ACE2F687-DBA0-487E-AE89-2344CFE2454C}'
              : '{C2F252E6-8F1A-4BC7-82C9-09FD77A6AAA6}'),
            (newItem.wfNodeType = 2),
            (newItem.selected = true)
          newItem.wfNodeName = '施工备案证变更镇街审核'
          this.indexData.push(newItem)
        })
        console.log(this.indexData, 'this.indexData')
      }
      if (this.isxtxgj == 1) {
        //农户选图选工匠发送给三个经办人
        let paramstaskid = {
          taskId: data,
          direction: 0,
          token: window.localStorage.getItem('token')
        }
        let paramsV2 = {
          accessCode: '0a709d649c314903a72225edb8bc8c2a',
          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: paramstaskid
        }
        //获取人员接口
        const resSend = await QuerySignCallback(paramsV2)
        var SendFormData = JSON.parse(resSend.data.data)
        this.tableData = JSON.parse(resSend.data.data)
        //掉存储过程获取人员
        //资格经办人 调用存储过程获资格经办人
        let I_ZJCITY = ''
        if (this.$route.query.data.BUILDTYPE == 14) {
          I_ZJCITY = this.$route.query.data.VILLAGE
        } else {
          I_ZJCITY = this.$route.query.data.CUN
        }
        let zjjbrex = {
          procName: 'up_townaudit',
          dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 2 }]),
          token: window.localStorage.getItem('token')
        }
        let zgjbrfu = {
          accessCode: '69db6bece3a7480592e2ec753d1e335e',

          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: zjjbrex
        }
        const reszgjbe = await FileServerProxy(zgjbrfu)
        let datazgjbr = JSON.parse(reszgjbe.data.data)
        //规划审核经办人
        let ghjbrex = {
          procName: 'up_townaudit',
          dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 3 }]),
          token: window.localStorage.getItem('token')
        }
        let ghjbrfu = {
          accessCode: '69db6bece3a7480592e2ec753d1e335e',

          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: ghjbrex
        }
        const resghjbrbe = await FileServerProxy(ghjbrfu)
        let dataghjbr = JSON.parse(resghjbrbe.data.data)
        //农房审核经办人
        let nfjbrex = {
          procName: 'up_townaudit',
          dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 4 }]),
          token: window.localStorage.getItem('token')
        }
        let nfjbrfu = {
          accessCode: '69db6bece3a7480592e2ec753d1e335e',

          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: nfjbrex
        }
        const resnfjbrbe = await FileServerProxy(nfjbrfu)
        let datanfjbr = JSON.parse(resnfjbrbe.data.data)
        SendFormData.SendData.forEach((nodeItem) => {
          var maxtnid = 0 //获取tnid最大值
          var tnid = nodeItem.TNID
          if (nodeItem.WFNODEGUID == '{417EFF61-5FA8-44D6-A624-5B3D0F39B56C}' && nodeItem.PTNID == -1) {
            //资格经办人
            datazgjbr.Data.forEach((zgjbr) => {
              var newItem = {}
              maxtnid = maxtnid + 1
              newItem.TNID = maxtnid
              newItem.PTNID = tnid
              newItem.TEXT = zgjbr.ST_NAME
              newItem.USERID = zgjbr.ST_ID
              newItem.AUTOCHECKED = true
              newItem.WFNODEGUID = nodeItem.WFNODEGUID
              newItem.WFNODENAME = nodeItem.WFNODENAME
              newItem.WFNODETYPE = nodeItem.WFNODETYPE
              newItem.SINGLEASSIGN = nodeItem.SINGLEASSIGN
              newItem.ISUSER = 1
              this.indexData.push(newItem)
            })
          }
          if (nodeItem.WFNODEGUID == '{0439EC7A-785D-4B5B-ADD4-11E2D320376E}' && nodeItem.PTNID == -1) {
            //规划经办人
            dataghjbr.Data.forEach((zgjbr) => {
              var newItem = {}
              maxtnid = maxtnid + 1
              newItem.TNID = maxtnid
              newItem.PTNID = tnid
              newItem.TEXT = zgjbr.ST_NAME
              newItem.USERID = zgjbr.ST_ID
              newItem.AUTOCHECKED = true
              newItem.WFNODEGUID = nodeItem.WFNODEGUID
              newItem.WFNODENAME = nodeItem.WFNODENAME
              newItem.WFNODETYPE = nodeItem.WFNODETYPE
              newItem.SINGLEASSIGN = nodeItem.SINGLEASSIGN
              newItem.ISUSER = 1
              this.indexData.push(newItem)
            })
          }
          if (nodeItem.WFNODEGUID == '{5821E9EB-44B5-49AC-A659-6DF98B410B38}' && nodeItem.PTNID == -1) {
            //农房经办人
            datanfjbr.Data.forEach((zgjbr) => {
              var newItem = {}
              maxtnid = maxtnid + 1
              newItem.TNID = maxtnid
              newItem.PTNID = tnid
              newItem.TEXT = zgjbr.ST_NAME
              newItem.USERID = zgjbr.ST_ID
              newItem.AUTOCHECKED = true
              newItem.WFNODEGUID = nodeItem.WFNODEGUID
              newItem.WFNODENAME = nodeItem.WFNODENAME
              newItem.WFNODETYPE = nodeItem.WFNODETYPE
              newItem.SINGLEASSIGN = nodeItem.SINGLEASSIGN
              newItem.ISUSER = 1
              this.indexData.push(newItem)
            })
          }
        })
        /*
        wjh 2022-0726 选图选工匠发送给批前公式  废弃不用，换成发给三个经办人
        // let paramstaskidtj = {
        //   taskId: data,
        //   direction: 0,
        //   token: window.localStorage.getItem("token"),
        // };
        // let paramsV2tj = {
        //   accessCode: "0a709d649c314903a72225edb8bc8c2a",
        //   cityCode: window.localStorage.getItem("citycode")
        //     ? window.localStorage.getItem("citycode")
        //     : "441300000000",
        //   params: paramstaskidtj,
        // };
        // //获取人员接口
        // const resSendtj = await QuerySignCallback(paramsV2tj);
        // var SendFormDatatj = JSON.parse(resSendtj.data.data);
        // this.tableData = SendFormDatatj;
        // //掉存储过程获取人员
        // //资格经办人 调用存储过程获资格经办人
        // let I_ZJCITY = "";
        // if (this.$route.query.data.BUILDTYPE == 14) {
        //   I_ZJCITY = this.$route.query.data.VILLAGE;
        // } else {
        //   I_ZJCITY = this.$route.query.data.CUN;
        // }
        // let zjjbrextj = {
        //   procName: "up_townaudit",
        //   dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 20 }]),
        //   token: window.localStorage.getItem("token"),
        // };
        // let zgjbrfutj = {
        //   accessCode: "69db6bece3a7480592e2ec753d1e335e",

        //   cityCode: window.localStorage.getItem("citycode")
        //     ? window.localStorage.getItem("citycode")
        //     : "441300000000",
        //   params: zjjbrextj,
        // };
        // const reszgjbetj = await FileServerProxy(zgjbrfutj);
        // let datazgjbrtj = JSON.parse(reszgjbetj.data.data);
        // SendFormDatatj.SendData.forEach((nodeItem) => {
        //   var maxtnid = 0; //获取tnid最大值
        //   var tnid = nodeItem.TNID;
        //   if (
        //   (nodeItem.WFNODEGUID == "{34A96C75-DF0E-4781-BA03-0F17FDD5B062}"||nodeItem.WFNODEGUID=="{342312E7-E3BC-426A-8568-E5E4EDD94A1A}") &&
        //     nodeItem.PTNID == -1
        //   ) {
        //     //资格经办人
        //     datazgjbrtj.Data.forEach((zgjbrtj) => {
        //       var newItem = {};
        //       maxtnid = maxtnid + 1;
        //       newItem.TNID = maxtnid;
        //       newItem.PTNID = tnid;
        //       newItem.TEXT = zgjbrtj.ST_NAME;
        //       newItem.USERID = zgjbrtj.ST_ID;
        //       newItem.AUTOCHECKED = true;
        //       newItem.WFNODEGUID = nodeItem.WFNODEGUID;
        //       newItem.WFNODENAME = nodeItem.WFNODENAME;
        //       newItem.WFNODETYPE = nodeItem.WFNODETYPE;
        //       newItem.SINGLEASSIGN = nodeItem.SINGLEASSIGN;
        //       newItem.ISUSER = 1;
        //       this.indexData.push(newItem);
        //     });
        //   }
        // });
        */
      } else if (this.ispqgs == 1) {
        //批前公示发给三个经办人
        // let paramstaskid = {
        //   taskId: data,
        //   direction: 0,
        //   token: window.localStorage.getItem("token"),
        // };
        // let paramsV2 = {
        //   accessCode: "0a709d649c314903a72225edb8bc8c2a",
        //   cityCode: window.localStorage.getItem("citycode")
        //     ? window.localStorage.getItem("citycode")
        //     : "441300000000",
        //   params: paramstaskid,
        // };
        // //获取人员接口
        // const resSend = await QuerySignCallback(paramsV2);
        // var SendFormData = JSON.parse(resSend.data.data);
        // this.tableData = JSON.parse(resSend.data.data);
        // //掉存储过程获取人员
        // //资格经办人 调用存储过程获资格经办人
        // let I_ZJCITY = "";
        // if (this.$route.query.data.BUILDTYPE == 14) {
        //   I_ZJCITY = this.$route.query.data.SSZZ;
        // } else {
        //   I_ZJCITY = this.$route.query.data.TOWN;
        // }
        // let zjjbrex = {
        //   procName: "up_townaudit",
        //   dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 2 }]),
        //   token: window.localStorage.getItem("token"),
        // };
        // let zgjbrfu = {
        //   accessCode: "69db6bece3a7480592e2ec753d1e335e",
        //   cityCode: window.localStorage.getItem("citycode")
        //     ? window.localStorage.getItem("citycode")
        //     : "441300000000",
        //   params: zjjbrex,
        // };
        // const reszgjbe = await FileServerProxy(zgjbrfu);
        // let datazgjbr = JSON.parse(reszgjbe.data.data);
        // //规划审核经办人
        // let ghjbrex = {
        //   procName: "up_townaudit",
        //   dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 3 }]),
        //   token: window.localStorage.getItem("token"),
        // };
        // let ghjbrfu = {
        //   accessCode: "69db6bece3a7480592e2ec753d1e335e",
        //   cityCode: window.localStorage.getItem("citycode")
        //     ? window.localStorage.getItem("citycode")
        //     : "441300000000",
        //   params: ghjbrex,
        // };
        // const resghjbrbe = await FileServerProxy(ghjbrfu);
        // let dataghjbr = JSON.parse(resghjbrbe.data.data);
        // //农房审核经办人
        // let nfjbrex = {
        //   procName: "up_townaudit",
        //   dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 3 }]),
        //   token: window.localStorage.getItem("token"),
        // };
        // let nfjbrfu = {
        //   accessCode: "69db6bece3a7480592e2ec753d1e335e",
        //   cityCode: window.localStorage.getItem("citycode")
        //     ? window.localStorage.getItem("citycode")
        //     : "441300000000",
        //   params: nfjbrex,
        // };
        // const resnfjbrbe = await FileServerProxy(nfjbrfu);
        // let datanfjbr = JSON.parse(resnfjbrbe.data.data);
        // SendFormData.SendData.forEach((nodeItem) => {
        //   var maxtnid = 0; //获取tnid最大值
        //   var tnid = nodeItem.TNID;
        //   if (
        //     nodeItem.WFNODEGUID == "{417EFF61-5FA8-44D6-A624-5B3D0F39B56C}" &&
        //     nodeItem.PTNID == -1
        //   ) {
        //     //资格经办人
        //     datazgjbr.Data.forEach((zgjbr) => {
        //       var newItem = {};
        //       maxtnid = maxtnid + 1;
        //       newItem.TNID = maxtnid;
        //       newItem.PTNID = tnid;
        //       newItem.TEXT = zgjbr.ST_NAME;
        //       newItem.USERID = zgjbr.ST_ID;
        //       newItem.AUTOCHECKED = true;
        //       newItem.WFNODEGUID = nodeItem.WFNODEGUID;
        //       newItem.WFNODENAME = nodeItem.WFNODENAME;
        //       newItem.WFNODETYPE = nodeItem.WFNODETYPE;
        //       newItem.SINGLEASSIGN = nodeItem.SINGLEASSIGN;
        //       newItem.ISUSER = 1;
        //       this.indexData.push(newItem);
        //     });
        //   }
        //   if (
        //     nodeItem.WFNODEGUID == "{0439EC7A-785D-4B5B-ADD4-11E2D320376E}" &&
        //     nodeItem.PTNID == -1
        //   ) {
        //     //规划经办人
        //     dataghjbr.Data.forEach((zgjbr) => {
        //       var newItem = {};
        //       maxtnid = maxtnid + 1;
        //       newItem.TNID = maxtnid;
        //       newItem.PTNID = tnid;
        //       newItem.TEXT = zgjbr.ST_NAME;
        //       newItem.USERID = zgjbr.ST_ID;
        //       newItem.AUTOCHECKED = true;
        //       newItem.WFNODEGUID = nodeItem.WFNODEGUID;
        //       newItem.WFNODENAME = nodeItem.WFNODENAME;
        //       newItem.WFNODETYPE = nodeItem.WFNODETYPE;
        //       newItem.SINGLEASSIGN = nodeItem.SINGLEASSIGN;
        //       newItem.ISUSER = 1;
        //       this.indexData.push(newItem);
        //     });
        //   }
        //   if (
        //     nodeItem.WFNODEGUID == "{5821E9EB-44B5-49AC-A659-6DF98B410B38}" &&
        //     nodeItem.PTNID == -1
        //   ) {
        //     //农房经办人
        //     datanfjbr.Data.forEach((zgjbr) => {
        //       var newItem = {};
        //       maxtnid = maxtnid + 1;
        //       newItem.TNID = maxtnid;
        //       newItem.PTNID = tnid;
        //       newItem.TEXT = zgjbr.ST_NAME;
        //       newItem.USERID = zgjbr.ST_ID;
        //       newItem.AUTOCHECKED = true;
        //       newItem.WFNODEGUID = nodeItem.WFNODEGUID;
        //       newItem.WFNODENAME = nodeItem.WFNODENAME;
        //       newItem.WFNODETYPE = nodeItem.WFNODETYPE;
        //       newItem.SINGLEASSIGN = nodeItem.SINGLEASSIGN;
        //       newItem.ISUSER = 1;
        //       this.indexData.push(newItem);
        //     });
        //   }
        // });
      } else if (this.isType) {
        let me = this
        //农户发起四到场申请(申请页面) wjh 2022-06-10
        var newwfGuid = ''
        var ExecProParam = ''
        var IsQF = ''
        if (me.isType.isdwfy == '1') {
          //定位放养
          newwfGuid = '{612C9C60-8D18-4D23-BF32-E9D9D01BB0EA}'
          ExecProParam = 9
          IsQF = 't'
        }
        if (me.isType.isjcyx == '1') {
          //基槽验线
          newwfGuid = '{460B4B5F-C3C2-4D4D-A702-17D4B4A3252F}'
          ExecProParam = 9
          IsQF = 't'
        }
        if (me.isType.isyclm == '1') {
          //一层立摸
          newwfGuid = '{7F042B34-7091-4884-A5D6-A615AE55497D}'
          ExecProParam = 12
          IsQF = 't'
        }
        if (me.isType.isjgys == '1') {
          //竣工验收
          newwfGuid = '{8FAD71FB-7756-4F0A-BEE8-4F6397B075A8}'
          ExecProParam = ''
          IsQF = 'f'
        }
        //创建流程接口
        let NHApplyParam = {
          accessCode: '2c824ce489ff4cffaa0d77082e6fb648',
          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: {
            wfGuid: newwfGuid,
            entityRowGuid: me.isType.data.ROW_GUID
          }
        }
        const NHApplyresData = await FileServerProxy(NHApplyParam)

        let SendFNHApplyresData = JSON.parse(NHApplyresData.data.data)
        var I_ZJCITY = ''
        if (me.isType.data.BUILDTYPE == 14) {
          I_ZJCITY = me.isType.data.VILLAGE
        } else {
          I_ZJCITY = me.isType.data.CUN
        }
        if (IsQF == 't') {
          let isNHApplyParam = {
            procName: 'up_townaudit',
            dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: ExecProParam }]),
            token: window.localStorage.getItem('token')
          }
          let xcfycjtfnApply = {
            accessCode: '69db6bece3a7480592e2ec753d1e335e',
            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: isNHApplyParam
          }
          const resxcfycjtApply = await FileServerProxy(xcfycjtfnApply)
          let dataxcfycjtApply = JSON.parse(resxcfycjtApply.data.data)
          if (dataxcfycjtApply.Data && dataxcfycjtApply.Data.length > 0) {
            dataxcfycjtApply.Data.forEach((item) => {
              SendFNHApplyresData.SendData.forEach((nodeItem) => {
                var maxtnid = 0 //获取tnid最大值
                if (nodeItem.PTNID != -1) {
                  var newItem = {}
                  var tnid = nodeItem.TNID
                  maxtnid = maxtnid + 1
                  newItem.TNID = maxtnid
                  newItem.PTNID = tnid
                  newItem.TEXT = item.ST_NAME
                  newItem.USERID = item.ST_ID
                  newItem.AUTOCHECKED = true
                  newItem.WFNODEGUID = nodeItem.WFNODEGUID
                  newItem.WFNODENAME = nodeItem.WFNODENAME
                  newItem.WFNODETYPE = nodeItem.WFNODETYPE
                  newItem.SINGLEASSIGN = nodeItem.SINGLEASSIGN
                  newItem.ISUSER = 1
                  me.indexData.push(newItem)
                }
              })
            })
          }
        } else {
          //竣工验收发送三个经办人
          let zjjbrex = {
            procName: 'up_townaudit',
            dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 13 }]),
            token: window.localStorage.getItem('token')
          }
          let zgjbrfu = {
            accessCode: '69db6bece3a7480592e2ec753d1e335e',

            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: zjjbrex
          }
          const reszgjbe = await FileServerProxy(zgjbrfu)
          let datazgjbr = JSON.parse(reszgjbe.data.data)
          //规划审核经办人
          let ghjbrex = {
            procName: 'up_townaudit',
            dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 15 }]),
            token: window.localStorage.getItem('token')
          }
          let ghjbrfu = {
            accessCode: '69db6bece3a7480592e2ec753d1e335e',

            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: ghjbrex
          }
          const resghjbrbe = await FileServerProxy(ghjbrfu)
          let dataghjbr = JSON.parse(resghjbrbe.data.data)
          //农房审核经办人
          let nfjbrex = {
            procName: 'up_townaudit',
            dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: 17 }]),
            token: window.localStorage.getItem('token')
          }
          let nfjbrfu = {
            accessCode: '69db6bece3a7480592e2ec753d1e335e',

            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: nfjbrex
          }
          const resnfjbrbe = await FileServerProxy(nfjbrfu)
          let datanfjbr = JSON.parse(resnfjbrbe.data.data)
          SendFNHApplyresData.SendData.forEach((nodeItem) => {
            var maxtnid = 0 //获取tnid最大值
            var tnid = nodeItem.TNID
            if (nodeItem.WFNODEGUID == '{5CC13346-8C53-4A37-989D-932716248754}' && nodeItem.PTNID == -1) {
              //资格经办人
              datazgjbr.Data.forEach((zgjbr) => {
                var newItem = {}
                maxtnid = maxtnid + 1
                newItem.TNID = maxtnid
                newItem.PTNID = tnid
                newItem.TEXT = zgjbr.ST_NAME
                newItem.USERID = zgjbr.ST_ID
                newItem.AUTOCHECKED = true
                newItem.WFNODEGUID = nodeItem.WFNODEGUID
                newItem.WFNODENAME = nodeItem.WFNODENAME
                newItem.WFNODETYPE = nodeItem.WFNODETYPE
                newItem.SINGLEASSIGN = nodeItem.SINGLEASSIGN
                newItem.ISUSER = 1
                me.indexData.push(newItem)
              })
            }
            if (nodeItem.WFNODEGUID == '{74864380-8590-4F8B-BD75-942E08F04D81}' && nodeItem.PTNID == -1) {
              //规划经办人
              dataghjbr.Data.forEach((zgjbr) => {
                var newItem = {}
                maxtnid = maxtnid + 1
                newItem.TNID = maxtnid
                newItem.PTNID = tnid
                newItem.TEXT = zgjbr.ST_NAME
                newItem.USERID = zgjbr.ST_ID
                newItem.AUTOCHECKED = true
                newItem.WFNODEGUID = nodeItem.WFNODEGUID
                newItem.WFNODENAME = nodeItem.WFNODENAME
                newItem.WFNODETYPE = nodeItem.WFNODETYPE
                newItem.SINGLEASSIGN = nodeItem.SINGLEASSIGN
                newItem.ISUSER = 1
                me.indexData.push(newItem)
              })
            }
            if (nodeItem.WFNODEGUID == '{7C289E35-88FC-4002-9B88-ED6F472CA872}' && nodeItem.PTNID == -1) {
              //农房经办人
              datanfjbr.Data.forEach((zgjbr) => {
                var newItem = {}
                maxtnid = maxtnid + 1
                newItem.TNID = maxtnid
                newItem.PTNID = tnid
                newItem.TEXT = zgjbr.ST_NAME
                newItem.USERID = zgjbr.ST_ID
                newItem.AUTOCHECKED = true
                newItem.WFNODEGUID = nodeItem.WFNODEGUID
                newItem.WFNODENAME = nodeItem.WFNODENAME
                newItem.WFNODETYPE = nodeItem.WFNODETYPE
                newItem.SINGLEASSIGN = nodeItem.SINGLEASSIGN
                newItem.ISUSER = 1
                me.indexData.push(newItem)
              })
            }
          })
        }
        //  if(this.isType.isdwfy=="1"){
        //   //定位放养申请
        //     let paramsgj = {
        //     accessCode: "2c824ce489ff4cffaa0d77082e6fb648",
        //     cityCode: window.localStorage.getItem("citycode")
        //       ? window.localStorage.getItem("citycode")
        //       : "441300000000",
        //     params: {
        //       wfGuid: "{612C9C60-8D18-4D23-BF32-E9D9D01BB0EA}",
        //       entityRowGuid: data.ROW_GUID,
        //     },
        //   };
        //   const resgj = await FileServerProxy(paramsgj);
        //   let SendFormDatagj = JSON.parse(resgj.data.data);
        //   if (SendFormDatagj.SendData.length > 0) {
        //     var I_USERID = "";
        //     let paramsDatasgj = {};
        //     paramsDatasgj.procName = "up_SFZHUSER";
        //     var CW = data.CWID;
        //     var NH = data.CERTIFICATECODE;
        //     var DBRSFZH = data.DBRSFZH;
        //      if((DBRSFZH?(DBRSFZH.toString().substr(DBRSFZH.length-1,1)):"") == "X"||(NH?(NH.toString().substr(NH.length-1,1)):"")=="X"){
        //       I_USERID ="'"+CW + "'" + "," + "'" + NH + "'" + ","+ "'" + DBRSFZH + "'";
        //     } else{
        //       I_USERID = CW + "," + NH + "," + DBRSFZH;
        //     }
        //     paramsDatasgj.dtParams = JSON.stringify([{ I_USERID: I_USERID }]);
        //     paramsDatasgj.token = window.localStorage.getItem("token");
        //     let paersgj = {
        //       accessCode: "69db6bece3a7480592e2ec753d1e335e",
        //       cityCode: window.localStorage.getItem("citycode")
        //         ? window.localStorage.getItem("citycode")
        //         : "441300000000",
        //       params: paramsDatasgj,
        //     };
        //     const reqsgj = await FileServerProxy(paersgj);
        //     var datasgj = JSON.parse(reqsgj.data.data);
        //     if (datasgj.Data && datasgj.Data.length > 0) {
        //       //现场放养
        //       if (
        //         this.$route.query.data2 == "定位放样" ||
        //         this.$route.query.data2 == "基槽验线" ||
        //         this.$route.query.data2 == "一层立模" ||
        //         this.$route.query.data2 == "竣工验收"
        //       ) {
        //         SendFormDatagj.SendData.forEach((nodeItem) => {
        //           var newwfguidgj = "";
        //           if (this.$route.query.data2 == "定位放样") {
        //             newwfguidgj = "{E359B708-D4B2-426F-BA00-45C5E94B6D7D}"; //现场放养
        //           }
        //           if (this.$route.query.data2 == "基槽验线") {
        //             newwfguidgj = "{576D4397-9795-4DA1-87CA-3B22A90D71B8}"; //基槽沿线
        //           }
        //           if (this.$route.query.data2 == "一层立模") {
        //             newwfguidgj = "{DD6E6B1C-BD45-4E2B-9086-FB533FAAC3B5}"; //一层立磨
        //           }
        //           if (this.$route.query.data2 == "竣工验收") {
        //             newwfguidgj = "{924CF865-825F-4257-9C64-BE2533B8C99B}"; //一层立磨
        //           }

        //           var maxtnid = 0; //获取tnid最大值
        //           if (
        //             nodeItem.WFNODEGUID == newwfguidgj &&
        //             nodeItem.PTNID == -1
        //           ) {
        //             var ArraynewItem = [];
        //             datasgj.Data.forEach((iigj) => {
        //               var newItem = {};
        //               var tnid = nodeItem.TNID;
        //               maxtnid = maxtnid + 1;
        //               newItem.TNID = maxtnid;
        //               newItem.PTNID = tnid;
        //               newItem.TEXT = iigj.USERNAME;
        //               newItem.USERID = iigj.USERID;
        //               newItem.AUTOCHECKED = true;
        //               newItem.WFNODEGUID = nodeItem.WFNODEGUID;
        //               newItem.WFNODENAME = nodeItem.WFNODENAME;
        //               newItem.WFNODETYPE = nodeItem.WFNODETYPE;
        //               newItem.SINGLEASSIGN = nodeItem.SINGLEASSIGN;
        //               newItem.ISUSER = 1;
        //               this.indexData.push(newItem);
        //             });
        //           }
        //         });
        //       }
        //     }
        //   }
        //  }
      } else if (this.isnhzg == '1') {
        //农户发送给镇街
        let self = this
        if (
          self.$route.query.data.WF_GUID == '{612C9C60-8D18-4D23-BF32-E9D9D01BB0EA}' ||
          self.$route.query.data.WF_GUID == '{460B4B5F-C3C2-4D4D-A702-17D4B4A3252F}' ||
          self.$route.query.data.WF_GUID == '{7F042B34-7091-4884-A5D6-A615AE55497D}'
        ) {
          var ExecProParam = ''
          if (self.$route.query.data.WF_GUID == '{612C9C60-8D18-4D23-BF32-E9D9D01BB0EA}' || self.$route.query.data.WF_GUID == '{460B4B5F-C3C2-4D4D-A702-17D4B4A3252F}') {
            ExecProParam = '9'
          } else if (self.$route.query.data.WF_GUID == '{7F042B34-7091-4884-A5D6-A615AE55497D}') {
            ExecProParam = 12
          }

          var IsQF = 't'
          this.sdcwfGuid = '{612C9C60-8D18-4D23-BF32-E9D9D01BB0EA}'
          //现场放样
          let paramstaskidxcfy = {
            taskId: self.$route.query.data.TASK_ID,
            direction: 0,
            token: window.localStorage.getItem('token')
          }
          let paramsVxcfy = {
            accessCode: '0a709d649c314903a72225edb8bc8c2a',
            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: paramstaskidxcfy
          }
          //获取人员接口
          const resSendtjdwfy = await QuerySignCallback(paramsVxcfy)
          let SendFNHApplyresdwfy = JSON.parse(resSendtjdwfy.data.data)
          var I_ZJCITY = ''
          if (self.$route.query.data.BUILDTYPE == 14) {
            I_ZJCITY = self.$route.query.data.VILLAGE
          } else {
            I_ZJCITY = self.$route.query.data.CUN
          }
          if (IsQF == 't') {
            let isNHApplyParamNH = {
              procName: 'up_townaudit',
              dtParams: JSON.stringify([{ I_USERID: I_ZJCITY, I_TYPE: ExecProParam }]),
              token: window.localStorage.getItem('token')
            }
            let xcfycjtfnApplynh = {
              accessCode: '69db6bece3a7480592e2ec753d1e335e',
              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: isNHApplyParamNH
            }
            const resxcfycjtApplynh = await FileServerProxy(xcfycjtfnApplynh)
            let dataxcfycjtApplynh = JSON.parse(resxcfycjtApplynh.data.data)
            if (dataxcfycjtApplynh.Data && dataxcfycjtApplynh.Data.length > 0) {
              dataxcfycjtApplynh.Data.forEach((item) => {
                SendFNHApplyresdwfy.SendData.forEach((nodeItem) => {
                  var maxtnid = 0 //获取tnid最大值
                  if (nodeItem.PTNID != -1) {
                    var newItem = {}
                    var tnid = nodeItem.TNID
                    maxtnid = maxtnid + 1
                    newItem.TNID = maxtnid
                    newItem.PTNID = tnid
                    newItem.TEXT = item.ST_NAME
                    newItem.USERID = item.ST_ID
                    newItem.AUTOCHECKED = true
                    newItem.WFNODEGUID = nodeItem.WFNODEGUID
                    newItem.WFNODENAME = nodeItem.WFNODENAME
                    newItem.WFNODETYPE = nodeItem.WFNODETYPE
                    newItem.SINGLEASSIGN = nodeItem.SINGLEASSIGN
                    newItem.ISUSER = 1
                    self.indexData.push(newItem)
                  }
                })
              })
            }
          }
        }
      } else {
        if (data !== '') {
          let params1 = {
            taskId: data,
            direction: 0,
            token: window.localStorage.getItem('token')
          }
          let params = {
            accessCode: '0a709d649c314903a72225edb8bc8c2a',

            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: params1
          }
          if (this.$route.query.data.PROC_NAME == '建房审批' || this.$route.query.data.PROC_NAME == '审批流程') {
            if (this.$route.query.data.NODE_GUID == '{5AC94EA9-AC60-475C-B903-346B5E120400}') {
              var paer1 = {
                procName: 'cs_xgzt',
                dtParams: JSON.stringify([
                  {
                    I_PROC_GUID: this.$route.query.data.PROC_GUID,
                    I_TYPE: 3,
                    I_ROW_GUID: this.$route.query.data.ROW_GUID,
                    I_PKID: this.$route.query.data.PKID
                  }
                ]),
                token: window.localStorage.getItem('token')
              }
            }
          } else {
            if (
              this.$route.query.data.NODE_GUID == '{D2048C7B-88F9-453C-8FB9-6CFBE287634F}' ||
              this.$route.query.data.NODE_GUID == '{E359B708-D4B2-426F-BA00-45C5E94B6D7D}' ||
              this.$route.query.data.NODE_GUID == '{757359B4-6AC2-4860-899F-94A348EC0177}' ||
              this.$route.query.data.NODE_GUID == '{576D4397-9795-4DA1-87CA-3B22A90D71B8}' ||
              this.$route.query.data.NODE_GUID == '{B3ACD6E6-CD10-42B4-9C36-B981DA0129E4}' ||
              this.$route.query.data.NODE_GUID == '{DD6E6B1C-BD45-4E2B-9086-FB533FAAC3B5}' ||
              this.$route.query.data.NODE_GUID == '{924CF865-825F-4257-9C64-BE2533B8C99B}'
            ) {
              var paer1 = {
                procName: 'cs_xgzt',
                dtParams: JSON.stringify([
                  {
                    I_PROC_GUID: this.$route.query.data.PROC_GUID,
                    I_TYPE: 4,
                    I_ROW_GUID: this.$route.query.data.ROW_GUID,
                    I_PKID: this.$route.query.data.PKID
                  }
                ]),
                token: window.localStorage.getItem('token')
              }
            }
          }
          let params2 = {
            accessCode: '69db6bece3a7480592e2ec753d1e335e',

            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: paer1
          }
          const req1 = await QuerySignCallback(params2)
          const res = await QuerySignCallback(params)
          eval('(' + res.data.data + ')').SendData.forEach((item) => {
            if (item.PTNID != -1) {
              this.indexData.push(item)
            }
          })
          this.tableData = eval('(' + res.data.data + ')')
          let str1 = this.$route.query.data.CERTIFICATECODE
          let str2 = this.$route.query.data.DBRSFZH
          if (this.$route.query.data.SQFS == 35) {
            var str = str1
          } else if (this.$route.query.data.SQFS == 36) {
            var str = str1 + ',' + str2
          }
          let paers = {
            procName: 'SFZHUSER',
            dtParams: JSON.stringify([{ I_USERID: str }]),
            token: window.localStorage.getItem('token')
          }
          let paramsee = {
            accessCode: '69db6bece3a7480592e2ec753d1e335e',

            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: paers
          }
          const reqw1 = await QuerySignCallback(paramsee)
        }
      }

      //获取人员信息并且传入到数组中只要补位-1的子集
      //   this.handleData()
      //村上值后调用发送接口
      this.handleGoToNext()
    },
    onClickLeft() {
      this.$router.back(-1)
    },
    // handleData () {
    //   this.indexData = []
    //   this.items.forEach(item => {
    //     if (item.PTNID != -1) {
    //       this.indexData.push(item)
    //     }
    //   })
    // },

    handleGoToNext: async function () {
      console.log(this.isnhzg, 'this.$route.query?.SJXK')
      if (this.$route.query?.SJXK != 1 && this.$route.query?.SJXK != 2 && this.$route.query?.SJXK != 5 && this.tableData1.length == 0) {
        let parms = {
          taskId: this.$route.query.data.TASK_ID,
          direction: 0,
          wfGuid: this.tableData.ProcInfo.WF_GUID,
          sendNodes: JSON.stringify(this.indexData),
          actionText: '同意',
          taskName: '浙里办',
          token: window.localStorage.getItem('token')
        }
        let params10 = {
          accessCode: 'c52bcf7cf3fb42bb9fbcd9b91e97d411',

          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: parms
        }
        if (this.$route.query.data.PROC_NAME == '建房审批' || this.$route.query.data.PROC_NAME == '审批流程') {
          //判断
          //判断当前是哪个审批环节  根据不同的审批环节更新不同值
          if (this.$route.query.data.NODE_GUID == '{5821E9EB-44B5-49AC-A659-6DF98B410B38}') {
            var paer = {
              procName: 'cs_xgjbrhj',
              dtParams: JSON.stringify([
                {
                  I_PROC_GUID: this.$route.query.data.PROC_GUID,
                  I_TYPE: 5,
                  I_ROW_GUID: this.$route.query.data.ROW_GUID,
                  I_PKID: this.$route.query.data.PKID
                }
              ]),
              token: window.localStorage.getItem('token')
            }
          } else if (this.$route.query.data.NODE_GUID == '{0439EC7A-785D-4B5B-ADD4-11E2D320376E}') {
            var paer = {
              procName: 'cs_xgjbrhj',
              dtParams: JSON.stringify([
                {
                  I_PROC_GUID: this.$route.query.data.PROC_GUID,
                  I_TYPE: 6,
                  I_ROW_GUID: this.$route.query.data.ROW_GUID,
                  I_PKID: this.$route.query.data.PKID
                }
              ]),
              token: window.localStorage.getItem('token')
            }
          } else if ((this.$route.query.data.NODE_GUID = '{5AC94EA9-AC60-475C-B903-346B5E120400}')) {
            var paer = {
              procName: 'cs_xgnhfsh',
              dtParams: JSON.stringify([
                {
                  I_PROC_GUID: this.$route.query.data.PROC_GUID,
                  I_TYPE: 1,
                  I_ROW_GUID: this.$route.query.data.ROW_GUID,
                  I_PKID: this.$route.query.data.PKID
                }
              ]),
              token: window.localStorage.getItem('token')
            }
          } else if ((this.$route.query.data.NODE_GUID = '{417EFF61-5FA8-44D6-A624-5B3D0F39B56C}')) {
            var paer = {
              procName: 'cs_xgjbrhj',
              dtParams: JSON.stringify([
                {
                  I_PROC_GUID: this.$route.query.data.PROC_GUID,
                  I_TYPE: 7,
                  I_ROW_GUID: this.$route.query.data.ROW_GUID,
                  I_PKID: this.$route.query.data.PKID
                }
              ]),
              token: window.localStorage.getItem('token')
            }
          }
          //   const req = await QuerySignCallback(paer);
        } else {
          //判断是哪个环节
          if (this.$route.query.data.NODE_GUID == '{D2048C7B-88F9-453C-8FB9-6CFBE287634F}') {
            var paer = {
              procName: 'cs_xgnhfsh',
              dtParams: JSON.stringify([
                {
                  I_PROC_GUID: this.$route.query.data.PROC_GUID,
                  I_TYPE: 11,
                  I_ROW_GUID: this.$route.query.data.ROW_GUID,
                  I_PKID: this.$route.query.data.PKID
                }
              ]),
              token: window.localStorage.getItem('token')
            }
          } else if (this.$route.query.data.NODE_GUID == '{E359B708-D4B2-426F-BA00-45C5E94B6D7D}') {
            var paer = {
              procName: 'cs_xgnhfsh',
              dtParams: JSON.stringify([
                {
                  I_PROC_GUID: this.$route.query.data.PROC_GUID,
                  I_TYPE: 2,
                  I_ROW_GUID: this.$route.query.data.ROW_GUID,
                  I_PKID: this.$route.query.data.PKID
                }
              ]),
              token: window.localStorage.getItem('token')
            }
          } else if (this.$route.query.data.NODE_GUID == '{757359B4-6AC2-4860-899F-94A348EC0177}') {
            var paer = {
              procName: 'cs_xgnhfsh',
              dtParams: JSON.stringify([
                {
                  I_PROC_GUID: this.$route.query.data.PROC_GUID,
                  I_TYPE: 12,
                  I_ROW_GUID: this.$route.query.data.ROW_GUID,
                  I_PKID: this.$route.query.data.PKID
                }
              ]),
              token: window.localStorage.getItem('token')
            }
          } else if (this.$route.query.data.NODE_GUID == '{576D4397-9795-4DA1-87CA-3B22A90D71B8}') {
            var paer = {
              procName: 'cs_xgnhfsh',
              dtParams: JSON.stringify([
                {
                  I_PROC_GUID: this.$route.query.data.PROC_GUID,
                  I_TYPE: 21,
                  I_ROW_GUID: this.$route.query.data.ROW_GUID,
                  I_PKID: this.$route.query.data.PKID
                }
              ]),
              token: window.localStorage.getItem('token')
            }
          } else if (this.$route.query.data.NODE_GUID == '{B3ACD6E6-CD10-42B4-9C36-B981DA0129E4}') {
            var paer = {
              procName: 'cs_xgnhfsh',
              dtParams: JSON.stringify([
                {
                  I_PROC_GUID: this.$route.query.data.PROC_GUID,
                  I_TYPE: 13,
                  I_ROW_GUID: this.$route.query.data.ROW_GUID,
                  I_PKID: this.$route.query.data.PKID
                }
              ]),
              token: window.localStorage.getItem('token')
            }
          } else if (this.$route.query.data.NODE_GUID == '{DD6E6B1C-BD45-4E2B-9086-FB533FAAC3B5}') {
            var paer = {
              procName: 'cs_xgnhfsh',
              dtParams: JSON.stringify([
                {
                  I_PROC_GUID: this.$route.query.data.PROC_GUID,
                  I_TYPE: 22,
                  I_ROW_GUID: this.$route.query.data.ROW_GUID,
                  I_PKID: this.$route.query.data.PKID
                }
              ]),
              token: window.localStorage.getItem('token')
            }
          }
          //判断当前是哪个审批环节  根据不同的审批环节更新不同值
          else if (this.$route.query.data.NODE_GUID == '{7C289E35-88FC-4002-9B88-ED6F472CA872}') {
            var paer = {
              procName: 'cs_xgsdcjbrhj',
              dtParams: JSON.stringify([
                {
                  I_PROC_GUID: this.$route.query.data.PROC_GUID,
                  I_TYPE: 10,
                  I_ROW_GUID: this.$route.query.data.ROW_GUID,
                  I_PKID: this.$route.query.data.PKID
                }
              ]),
              token: window.localStorage.getItem('token')
            }
          } else if (this.$route.query.data.NODE_GUID == '{74864380-8590-4F8B-BD75-942E08F04D81}') {
            var paer = {
              procName: 'cs_xgsdcjbrhj',
              dtParams: JSON.stringify([
                {
                  I_PROC_GUID: this.$route.query.data.PROC_GUID,
                  I_TYPE: 9,
                  I_ROW_GUID: this.$route.query.data.ROW_GUID,
                  I_PKID: this.$route.query.data.PKID
                }
              ]),
              token: window.localStorage.getItem('token')
            }
          } else if (this.$route.query.data.NODE_GUID == '{924CF865-825F-4257-9C64-BE2533B8C99B}') {
            var paer = {
              procName: 'cs_xgnhfsh',
              dtParams: JSON.stringify([
                {
                  I_PROC_GUID: this.$route.query.data.PROC_GUID,
                  I_TYPE: 23,
                  I_ROW_GUID: this.$route.query.data.ROW_GUID,
                  I_PKID: this.$route.query.data.PKID
                }
              ]),
              token: window.localStorage.getItem('token')
            }
          } else if (this.$route.query.data.NODE_GUID == '{5CC13346-8C53-4A37-989D-932716248754}') {
            var paer = {
              procName: 'cs_xgsdcjbrhj',
              dtParams: JSON.stringify([
                {
                  I_PROC_GUID: this.$route.query.data.PROC_GUID,
                  I_TYPE: 8,
                  I_ROW_GUID: this.$route.query.data.ROW_GUID,
                  I_PKID: this.$route.query.data.PKID
                }
              ]),
              token: window.localStorage.getItem('token')
            }
          }
        }
        const res = await QuerySignCallback(params10)
        if (eval('(' + res.data.data + ')').Success == true) {
          //判断当前环节是否为农户、村委
          //   if (window.localStorage.getItem('isNHCW')) {
          //     let dataGuid = '5094c2da-54c4-4475-96f7-09145699cc3e'
          //     let searchObject = encodeURIComponent(JSON.stringify([
          //       {
          //         field: 'entityrowguid',
          //         value: this.$route.query.data.ROW_GUID,
          //         'link': 'AND',
          //         'operator': "="
          //       },
          //       {
          //         field: 'TASK_ID',
          //         value: this.$route.query.data.TASK_ID,
          //         'link': 'AND',
          //         'operator': "<>"
          //       }
          //     ]))
          //     let token = window.localStorage.getItem('token')
          //     const res1 = await dataServerOpenDataView(dataGuid, searchObject, token)
          //     if (res1.data.Data.length > 0) {
          //       window.localStorage.removeItem('isNHCW')
          //       let params = {
          //         dataGuid: "f01f9e75-5692-42a2-8f14-4b383258410c",
          //         strParams: JSON.stringify([
          //           {
          //             TASK_ID: res1.data.Data[0].TASK_ID,
          //             TASK_STATUS: 5,
          //           },
          //         ]),
          //         token: window.localStorage.getItem('token')
          //       };
          //       const res2 = await updateDataView(params)
          //     }
          //   }
          if (this.$route.query.data.PROC_NAME == '建房审批' || this.$route.query.data.PROC_NAME == '审批流程') {
            let paer = {
              procName: 'cs_xgzt',
              dtParams: JSON.stringify([{ PROC_GUID: this.$route.query.data.PROC_GUID, I_TYPE: 1 }]),
              token: window.localStorage.getItem('token')
            }
            let params2 = {
              accessCode: '69db6bece3a7480592e2ec753d1e335e',

              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: paer
            }
            const req = await QuerySignCallback(params2)
          } else {
            let paer = {
              procName: 'cs_xgzt',
              dtParams: JSON.stringify([{ PROC_GUID: this.$route.query.data.PROC_GUID, I_TYPE: 2 }]),
              token: window.localStorage.getItem('token')
            }
            let params2 = {
              accessCode: '69db6bece3a7480592e2ec753d1e335e',

              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
              params: paer
            }
            const req = await QuerySignCallback(params2)
          }
          this.$toast.success('成功！')
          // this.$notify({ type: 'success', message: '成功！' });
          let params3 = {
            accessCode: '69db6bece3a7480592e2ec753d1e335e',

            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: paer
          }
          const req = await QuerySignCallback(params3)
          if (this.ispqgs == '1') {
            setTimeout(() => {
              this.$router.push({
                path: '/FeatureList'
              })
            }, 1000)
          } else {
            setTimeout(() => {
              this.$router.push({
                path: '/ZLJIndex'
              })
            }, 1000)
          }
        } else {
          //发起
          this.handle2(this.code1, this.indexData)
          if (this.ispqgs == '1') {
            setTimeout(() => {
              this.$router.push({
                path: '/FeatureList'
              })
            }, 1000)
          } else {
            setTimeout(() => {
              this.$router.push({
                path: '/ZLJIndex'
              })
            }, 1000)
          }
        }
      } else if (this.isnhzg == '1' && this.indexData.length > 0) {
        //施工备案
        let parms = {
          taskId: this.$route.query.data.TASK_ID,
          direction: 0,
          wfGuid: this.sdcwfGuid,
          sendNodes: JSON.stringify(this.indexData),
          actionText: '同意',
          taskName: '浙政钉',
          token: window.localStorage.getItem('token')
        }
        let params3 = {
          accessCode: 'c52bcf7cf3fb42bb9fbcd9b91e97d411',

          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: parms
        }
        const res = await QuerySignCallback(params3)
        if (res && JSON.parse(res.data.data) && JSON.parse(res.data.data).Success) {
          // TODO:
        }

        setTimeout(() => {
          this.$router.push({
            path: '/ZLJIndex'
          })
        }, 1000)
      } else if ((this.$route.query?.SJXK == 1 || this.$route.query?.SJXK == '2' || this.$route.query?.SJXK == '5') && this.indexData.length > 0) {
        let DQHDAta = JSON.parse(window.sessionStorage.getItem('fileData'))
        let parms = {
          taskId: this.TASK_ID,
          direction: 0,
          wfGuid:
            this.$route.query?.SJXK == 1
              ? '{5F605C24-CFE0-49A1-B4EC-2BA85C5FF672}'
              : this.$route.query?.SJXK == 2
              ? '{D8CE8FDE-C99C-4951-870E-CD03FA9E6FB5}'
              : '{7A440F29-3FD5-498A-AE43-F6C4E1350B34}',
          sendNodes: JSON.stringify(this.indexData),
          actionText: '同意',
          taskName: '浙里办',
          token: window.localStorage.getItem('token')
        }
        let params3 = {
          accessCode: 'c52bcf7cf3fb42bb9fbcd9b91e97d411',
          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: parms
        }
        const res = await QuerySignCallback(params3)
        if (res && JSON.parse(res.data.data) && JSON.parse(res.data.data).Success) {
          setTimeout(() => {
            this.$router.push({
              path: '/ZLJIndex'
            })
          }, 1000)
        } else {
          this.$toast.fail('任务未签收或者已处理')
          setTimeout(() => {
            this.$router.go(-1)
          }, 1000)
        }
      } else {
        this.$notify({ type: 'danger', message: '请选择发送人员！' })
      }
      //发送短信
      if (this.$route.query && (this.$route.query.isdwfy == '1' || this.isType)) {
        //现场放养申请
        //调用存储过程获取人员手机号
        var strMessqge = this.$route.query.data.CWID + ',' + this.$route.query.data.NHID
        let paerssend = {
          procName: 'message',
          dtParams: JSON.stringify([{ I_USERID: strMessqge, I_TYPE: 3 }]),
          token: window.localStorage.getItem('token')
        }
        let paramsendMEssage = {
          accessCode: '69db6bece3a7480592e2ec753d1e335e',

          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: paerssend
        }
        const reqwmsg = await QuerySignCallback(paramsendMEssage)
        const JSONSend = JSON.parse(reqwmsg.data.data)
        if (JSONSend && JSONSend.Data && JSONSend.Data.length > 0) {
          JSONSend.Data.forEach((phone) => {
            let paramdf = {
              mobiles: phone.MOBILETEL,
              templateId: '9a891424f9884d75b19163a95d8a5094',

              accessCode: '11b5cfe531954d94bb924c856e63a99b'
            }
            // 发送短信通知
            sendBusinessMessage(paramdf)
          })
        }
      }
      if ((this.$route.query && (this.$route.query.isjcyx == '1' || this.$route.query.isyclm == '1' || this.$route.query.isjgys == '1')) || this.isType) {
        //现场放养申请
        //调用存储过程获取人员手机号
        var temph = ''
        var strMessqgeh = this.$route.query.data.CWID + ',' + this.$route.query.data.NHID
        let paerssendh = {
          procName: 'message',
          dtParams: JSON.stringify([{ I_USERID: strMessqgeh, I_TYPE: 3 }]),
          token: window.localStorage.getItem('token')
        }
        let paramsendMEssageh = {
          accessCode: '69db6bece3a7480592e2ec753d1e335e',

          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: paerssendh
        }
        const reqwmsgh = await QuerySignCallback(paramsendMEssageh)
        const JSONSendh = JSON.parse(reqwmsgh.data.data)
        if (this.isType.isjcyx == '1') {
          //基槽验线
          temph = '81b96d82b66f413589b7d9572fa9e708'
        }
        if (this.isType.isyclm == '1') {
          //一层立磨
          temph = '443c9167bbf24a8d81fb0707e3f207ea'
        }
        if (this.isType.isjgys == '1') {
          //竣工验收
          temph = '05cf2dc7667e4a478a3d377b8e0dcddc'
        }
        if (JSONSendh && JSONSendh.Data && JSONSendh.Data.length > 0) {
          JSONSendh.Data.forEach((phone) => {
            let paramdfh = {
              mobiles: phone.MOBILETEL,
              templateId: temph,

              accessCode: '11b5cfe531954d94bb924c856e63a99b'
            }
            // 发送短信通知
            sendBusinessMessage(paramdfh)
          })
        }
      }
    },
    handle2: async function (data, data1) {
      let parms = {
        bizGuid: '53f76168-18bb-4ef9-96cf-70dbacd12000',
        wfGuid: '{9FF1C524-B55F-4A45-83B3-6EA46CF32092}',
        entityRowGuid: data,
        token: window.localStorage.getItem('token')
      }
      let params1 = {
        accessCode: '69db6bece3a7480592e2ec753d1e335e',

        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: parms
      }
      const res = await QuerySignCallback(params1)
      //成功后调用3接口完成
      this.handle3(data, eval('(' + res.data.data + ')').TaskId, data1)
    },
    handle3: async function (data, data2, data1) {
      let parms = {
        taskId: data2,
        direction: 0,
        wfBoxGuid: '53f76168-18bb-4ef9-96cf-70dbacd12000',
        wfGuid: '{9FF1C524-B55F-4A45-83B3-6EA46CF32092}',
        sendNodes: JSON.stringify(data1),
        entityRowGuid: data,
        actionText: '',
        taskName: '',
        token: window.localStorage.getItem('token')
      }
      let params = {
        accessCode: '59761fe0fc4948bfb02382b4e2dd1bde',

        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: parms
      }
      const res = await QuerySignCallback(params)
      this.$toast.success('保存成功！')
      // this.$notify({ type: 'success', message: '保存成功！' });
    }
  },
  mounted() {
    if (this.$route.query.data && (this.$route.query.data.isdwfy || this.$route.query.data.isjcyx || this.$route.query.data.isyclm || this.$route.query.data.isjgys)) {
      this.isType = this.$route.query.data
      //this.rowData=JSON.stringify( this.$route.query.data);
    }
    //new流程
    if (this.$route.query.data && (this.$route.query.isdwfy || this.$route.query.isjcyx || this.$route.query.isyclm || this.$route.query.isjgys)) {
      this.isType = this.$route.query
      //this.rowData=JSON.stringify( this.$route.query.data);
    }
    //判断是否是农户整改
    if (this.$route.query.isnhzg) {
      this.isnhzg = this.$route.query.isnhzg
      this.tableData1.push(this.$route.query.data)
    }
    //判断是否是选图选工匠环节
    if (this.$route.query && this.$route.query.isxgj == 1) {
      this.isxtxgj = 1
    } else if (this.$route.query && this.$route.query.ispqgs == 1) {
      this.ispqgs = 1
    }

    //接收浙里办传来的参数
    if (this.$route.query.data2 && this.$route.query.data1) {
      this.tableData1 = this.$route.query.data2
      this.code1 = this.$route.query.data1
      this.getData('')
    } else {
      try {
        this.getData(this.$route.query.data.TASK_ID ? this.$route.query.data.TASK_ID : '')
      } catch (err) {}
    }
  }
}
</script>
<style lang="scss" scoped>
.TreeSelect {
  height: 100vh;
  background: #fff;
  font-size: 0.2em;
}
</style>
